package com.wyl.template.util;

import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

import javax.annotation.PostConstruct;

/**
 * @Auther: wyl
 * @Date: 2021/6/16
 * @Description:
 */
@Component
public class IDUtil {

    private static SnowflakeIdWorker idWorker;

    @PostConstruct
    public void init() {
        idWorker = new SnowflakeIdWorker(0, 0);
    }


    public static String getID(){
//        String id = UUID.randomUUID().toString();
        long nextId = idWorker.nextId();
        return Long.toString(nextId);
    }

}
